﻿using UnityEngine;
#if  UNITY_IOS&&!DEVELOP
using System.Runtime.InteropServices;
#endif
namespace QQSDK
{
    public enum Permission
    {
        GRANTED_ALBUM,
        REFUSE_ALBUM,
        GRANTED_CAMERA,
        REFUSE_CAMERA
    }
    public enum MediaType
    {
        Picture,
        Video
    }
    public class ToolsManager
    {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                [DllImport("__Internal")]
                private static extern void Vibrator(int type);
                [DllImport("__Internal")]
                private static extern void SendEMail(string recipients, string subject, string productName);
                [DllImport("__Internal")]
                private static extern void SendEMailCallBack(string gameObjectName, string gameFuncName, string recipients, string subject, string productName);
                [DllImport("__Internal")]
                private static extern void ShowSystemCommentDialog();
                [DllImport("__Internal")]
                private static extern void CopyStringToClipboard(string content);
                [DllImport("__Internal")]
                private static extern bool HasInstallApp(string urlSchemes);
                [DllImport("__Internal")]
                private static extern void ShareNative(string path);
                [DllImport("__Internal")]
                private static extern void SaveToAlbum(string path);
                [DllImport("__Internal")]
                private static extern void SaveToAlbumCallBack(string gameObjectName, string gameFuncName, string path, int type);
                [DllImport("__Internal")]
                private static extern void ShareToInstagram(string path);
                [DllImport("__Internal")]
                private static extern void ShareToInstagramCallBack(string gameObjectName, string gameFuncName, string path);
                [DllImport("__Internal")]
                private static extern bool CheckCameraPermission();
                [DllImport("__Internal")]
                private static extern bool CheckAlbumPermission();
                [DllImport("__Internal")]
                private static extern void RequestCameraPermission();
                [DllImport("__Internal")]
                private static extern void RequestCameraPermissionCallBack(string gameObjectName, string gameFuncName);
                [DllImport("__Internal")]
                private static extern void RequestIDFAPermissionCallBack(string gameObjectName, string gameFuncName);
                [DllImport("__Internal")]
                private static extern void RequestAlbumPermission();
                [DllImport("__Internal")]
                private static extern void RequestAlbumPermissionCallBack(string gameObjectName, string gameFuncName);
                [DllImport("__Internal")]
                private static extern bool IsIphoneXAbove();
                [DllImport("__Internal")]
                private static extern bool IsIPad();
                [DllImport("__Internal")]
                private static extern string GetCountry(); //新加的
                [DllImport("__Internal")]
                private static extern string GetLanguage();
                [DllImport("__Internal")]
                private static extern string GetLocale();
                [DllImport("__Internal")]
                private static extern string GetVersionName();
                [DllImport("__Internal")]
                private static extern string GetVersionCode();
                [DllImport("__Internal")]
                private static extern string RequestIDFAPermission();
                [DllImport("__Internal")]
                private static extern void PopupUpdateNoticeDialog(string appStoreID, string titileText, string positiveText, string cancelText, string customMesage);
                [DllImport("__Internal")]
                private static extern void showGDPR(string privaryPolicy);
                [DllImport("__Internal")]
                private static extern void showToast(string msg);
                [DllImport("__Internal")]
                private static extern int DebugOrRelease();
                [DllImport("__Internal")]
                private static extern void jumpToComment();
                [DllImport("__Internal")]
                private static extern string getIDFA();
                [DllImport("__Internal")]
                private static extern void getIphoneUaMessage();
                [DllImport("__Internal")]
                private static extern void getIphoneIP();
                
#elif UNITY_ANDROID
                public static AndroidJavaObject AJO;
#endif

        public static void Set()
        {
            SDKFunc.Log("设置归因");
#if UNITY_EDITOR || DEVELOP
            //Invoke("doOnInitAdsSucceed", 2);
#elif UNITY_IOS && !DELSDK
#elif UNITY_ANDROID
            AJO = SDKManager.SDK_Tools;
            if (AJO  != null)
                 AJO.CallStatic("init", SDKManager.GetContext());
#elif UNITY_WEBGL

#else

#endif
        }
        /// <summary>
        /// Shares to instagram.分享到instagram
        /// 返回：0:分享成功，
        ///      1:未安装instagram,
        ///      2:文件路径错误，文件未找到
        /// </summary>
        /// <param name="gameObjectName">接收回调的Unity Gameobject对象</param>
        /// <param name="gameFuncName">接收回调的Unity Gameobject对象上的函数名</param>
        /// <param name="path">分享文件的路径</param>
        public static void ShareInstagram(string gameObjectName, string gameFuncName, string path)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        ShareToInstagramCallBack(gameObjectName, gameFuncName, path);
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("shareInstagram", gameObjectName, gameFuncName, path);
#endif
        }
        /// <summary>
        /// Sends the email.  
        /// </summary>
        /// <param name="recipients"> 收件人</param>
        /// <param name="subjects">标题，主题</param>
        public static void SendEmail(string recipients, string subjects, string productName)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        SendEMail(recipients, subjects, productName);
#elif UNITY_ANDROID
                        Application.OpenURL("mailto:" + recipients + "?subject=" + subjects + "&body=" + productName);
#endif
        }
        /// <summary>
        /// Sends the email.  
        /// </summary>
        /// <param name="recipients"> 收件人</param>
        /// <param name="subjects">标题，主题</param>
        public static void SendEmail(string gameObjectName, string gameFuncName, string recipients, string subjects, string productName)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        SendEMailCallBack(gameObjectName, gameFuncName, recipients, subjects, productName);
#elif UNITY_ANDROID
                        Application.OpenURL("mailto:" + recipients + "?subject=" + subjects + "&body=" + productName);
#endif
        }
        /// <summary>
        /// Shares the more in local.本地分享
        /// 返回：0:分享成功，
        ///      2:文件路径错误，文件未找到
        /// </summary>
        /// <param name="gameObjectName">Path.</param>
        /// <param name="gameFuncName">Title.</param>
        /// <param name="path">Title.</param>
        /// <param name="title">Title.</param>
        public static void ShareNative(string gameObjectName, string gameFuncName, string path, string title)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        ShareNative(path);
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("shareNative", gameObjectName, gameFuncName, path, title);
#endif
        }
        /// <summary>
        /// Copies the text to clipboard. 拷贝文字到剪切板
        /// </summary>
        /// <param name="text">Text.</param>
        public static void CopyTextToClipboard(string text)
        {
#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log(" 拷贝   " + text + "   到剪切板");
#elif UNITY_IOS && !DELSDK
                        CopyStringToClipboard(text);
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("copyStringToClipboard", text);
#endif
        }
        /// <summary>
        /// Vibrator the specified second.  安卓传入震动时长 iOS 1为轻度震动，其他参数为强震动
        /// </summary>
        /// <param name="millisecond">second.</param>
        public static void Vibrator(long second)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        if (second == 1)
                        {
                                Vibrator(1);
                        }
                        else
                        {
                                Vibrator(2);
                        }
#elif UNITY_ANDROID
                        if (second < 999)//防止业务侧把参数当成毫秒使用
                            second = second * 1000;
                        if (AJO  != null)
                                AJO.CallStatic("vibrator", second);
#endif
        }
        public static bool CheckAndroidPermission(string permission)
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return false;
#elif UNITY_ANDROID
                        if (AJO  != null)
                                return AJO.CallStatic<bool>("checkPermission", permission);
                        return false;
#else
                        return false;
#endif
        }
        public static void RequestAndroidPermission(string permission)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("requestPermission", SDKManager.GetCurrentlyActivity(), permission);
#endif
        }
        /// <summary>
        /// Checks the apple camera permission.
        /// </summary>
        /// <returns><c>true</c>, if apple camera permission was checked, <c>false</c> otherwise.</returns>
        public static bool CheckAppleCameraPermission()
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return CheckCameraPermission();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
                        return false;
#else
                        return false;
#endif
        }
        /// <summary>
        /// Checks the apple album permission.
        /// </summary>
        /// <returns><c>true</c>, if apple album permission was checked, <c>false</c> otherwise.</returns>
        public static bool CheckAppleAlbumPermission()
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return CheckAlbumPermission();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
                        return false;
#else
                        return false;
#endif
        }
        /// <summary>
        /// Requests the apple camera permission.
        /// </summary>
        public static void RequestAppleCameraPermission()
        {
#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("申请相机权限");
#elif UNITY_IOS && !DELSDK
                        RequestCameraPermission();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Requests the apple camera permission.
        /// </summary>
        public static void RequestAppleCameraPermission(string gameObjectName, string gameFuncName)
        {

#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("申请相机权限");
#elif UNITY_IOS && !DELSDK
                        RequestCameraPermissionCallBack(gameObjectName, gameFuncName);
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Requests the apple ablum permission.
        /// </summary>
        public static void RequestAppleAblumPermission()
        {

#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("申请相册权限");
#elif UNITY_IOS && !DELSDK
                        RequestAlbumPermission();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Requests the apple ablum permission.
        /// </summary>
        public static void RequestAppleAblumPermission(string gameObjectName, string gameFuncName)
        {

#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("申请相册权限");
#elif UNITY_IOS && !DELSDK
                        RequestAlbumPermissionCallBack(gameObjectName, gameFuncName);
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Requests the apple ios14 idfa permission.
        /// </summary>
        public static void RequestIDFAPermission(string gameObjectName, string gameFuncName)
        {

#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("申请ios14idfa权限");
#elif UNITY_IOS && !DELSDK
                        RequestIDFAPermissionCallBack(gameObjectName, gameFuncName);
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Ises the iphone X Above divice.
        /// </summary>
        /// <returns><c>true</c>, if iphone XA bove divice was ised, <c>false</c> otherwise.</returns>
        public static bool IsIphoneXAboveDivice()
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return IsIphoneXAbove();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
                        return false;
#else
                        return false;
#endif
        }
        /// <summary>
        /// Saves the video.保存多媒体到相册
        /// 返回：0:分享成功，
        ///      2:文件路径错误，文件未找到
        /// </summary>
        /// <param name="gameObjectName">接收回调的对象.</param>
        /// <param name="gameFuncName">接收回调的函数.</param>
        /// <param name="filePath">文件路径.</param>
        /// <param name="mediaType">媒体类型.</param>
        public static void SaveMedia(string gameObjectName, string gameFuncName, string filePath, MediaType mediaType)
        {
            int type = 1;
            if (mediaType == MediaType.Picture)
            {
                type = 0;
            }
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        SaveToAlbumCallBack(gameObjectName, gameFuncName, filePath, type);
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("saveToAlbum", gameObjectName, gameFuncName, filePath, type);
#endif
        }
        /// <summary>
        /// Copies the file.拷贝文件
        /// </summary>
        /// <param name="fromFile">From file.</param>
        /// <param name="toFile">To file.</param>
        public static void CopyFile(string fromFile, string toFile)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK

#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("copyFile", fromFile, toFile);
#endif
        }
        /// <summary>
        /// Shows the apple system comment dialog. 弹出ios系统的评论界面
        /// </summary>
        public static void ShowAppleSystemCommentDialog()
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        ShowSystemCommentDialog();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// Ises the app install.当前应用是否安装
        /// </summary>
        /// <returns><c>true</c>, if app install was ised, <c>false</c> otherwise.</returns>
        /// <param name="packageNameOrUrlSchemes">Package name.</param>
        public static bool IsAppInstall(string packageNameOrUrlSchemes)
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return HasInstallApp(packageNameOrUrlSchemes);
#elif UNITY_ANDROID
                        if (AJO  != null)
                        {
                                return AJO.CallStatic<bool>("isAppInstall", packageNameOrUrlSchemes);
                        }
                        else
                        {
                                return false;
                        }
#else
                        return false;
#endif
        }
 



        /// <summary>
        /// GetAndroidId
        /// </summary>
        public static string GetAndroidId()
        {
            string deviceid = string.Empty;
#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("GetAndroidId");
#elif UNITY_ANDROID
            if (AJO != null)
                deviceid = AJO.CallStatic<string>("getDeviceId");
#elif UNITY_IOS && !DELSDK

#endif
            return deviceid;
        }


        /// <summary>
        /// GetAndroidIMEI
        /// </summary>
        public static string GetAndroidIMEI()
        {
            string deviceid = string.Empty;
#if UNITY_EDITOR || DEVELOP
            SDKFunc.Log("GetAndroidIMEI");
#elif UNITY_ANDROID
            if (AJO != null)
                deviceid = AJO.CallStatic<string>("getIMEI");
#elif UNITY_IOS && !DELSDK

#endif
            return deviceid;
        }
        public static string GetIOSIDFA()
        {
            string idfa = string.Empty;
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
            idfa = getIDFA();
            return idfa;
#elif UNITY_ANDROID
          
#elif UNITY_WEBGL

#else

#endif
            return idfa;

        }

        public static void GetIOSUaMessage()
        {
          
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
             getIphoneUaMessage();
            
#elif UNITY_ANDROID   
          
#elif UNITY_WEBGL

#else

#endif


        }

        public static void GetIOSAfIp()
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
            getIphoneIP();
#elif UNITY_ANDROID
          
#elif UNITY_WEBGL

#else

#endif

        }

        public static string GetChannelName()
        {
            return ReadValueFromManifest("CHANNEL_NAME");
        }

        public static string ReadValueFromManifest(string Manifestkey)
        {
            string valueString = "";
#if UNITY_EDITOR || DEVELOP
            return valueString;
#elif UNITY_IOS && !DELSDK
                        return valueString;
#elif UNITY_ANDROID
                        if (AJO  != null)
                        {
                                string value = AJO.CallStatic<string>("readValueFromManifestToString", Manifestkey);
                                if (value != null)
                                {
                                        valueString = value;
                                }
                        }
                        return valueString;
#else
                        return valueString;
#endif
        }

        public static string GetPackageName()
        {
#if UNITY_EDITOR || DEVELOP
            return "";
#elif UNITY_IOS && !DELSDK
                        return GetVersionName();
#elif UNITY_ANDROID
                        if (AJO  != null)
                                return AJO.CallStatic<string>("getPackageName");
                        else
                            return "";
#else
                        return "";
#endif
        }
        public static string GetVerName()
        {
#if UNITY_EDITOR || DEVELOP
            return "";
#elif UNITY_IOS && !DELSDK
                        return GetVersionName();
#elif UNITY_ANDROID
                        if (AJO  != null)
                                return AJO.CallStatic<string>("getVersionName");
                        else
                            return "";
#else
                        return "";
#endif
        }
        public static int GetVerCode()
        {
#if UNITY_EDITOR || DEVELOP
            return 0;
#elif UNITY_IOS && !DELSDK
                        return int.Parse(GetVersionCode());
#elif UNITY_ANDROID
                        if (AJO  != null)
                                return AJO.CallStatic<int>("getVersionCode");
                        else
                            return 0;
#else
                        return 0;
#endif
        }

        /// <summary>
        ///  获取系统语言
        /// </summary>
        /// <returns></returns>
        public static string GetSystemCountry()
        {
#if UNITY_EDITOR || DEVELOP
            return "";
#elif UNITY_IOS && !DELSDK
                        return GetCountry();
#elif UNITY_ANDROID
                    if (AJO  != null)
                        return AJO.CallStatic<string>("getSystemCountry");
                    else
                        return "";
#else
                        return "";
#endif
        }
        /// <summary>
        ///  获取系统语言
        /// </summary>
        /// <returns></returns>
        public static string GetSystemLanguage()
        {
#if UNITY_EDITOR || DEVELOP
            return "";
#elif UNITY_IOS && !DELSDK
                        return GetLanguage();
#elif UNITY_ANDROID
        if (AJO  != null)
                        return AJO.CallStatic<string>("getSystemLanguage");
            else
                        return "";
#else
            return "";
#endif

        }

        /// <summary>
        /// 下载安卓Apk（适用与国内直接更新Apk）
        /// </summary>
        /// <param name="channelKey"></param>
        /// <param name="packageName"></param>
        public static void DownLoadAndroidApk(string downloadUrl)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        SDKFunc.Log("当前平台调用无效");
#elif UNITY_ANDROID
                        if (AJO  != null)
                        {
                                AJO.CallStatic("registerDownloadApk", SDKManager.GetCurrentlyActivity());
                                AJO.CallStatic("downloadApk", downloadUrl);
                        }
#endif
        }
        /// <summary>
        /// 获取当前位置
        /// </summary>
        /// <returns></returns>返回 参考 https://blog.csdn.net/mreinhard/article/details/45270205https://blog.csdn.net/mreinhard/article/details/45270205
        public static string GetLacation()
        {
#if UNITY_EDITOR || DEVELOP
            return "CN";
#elif UNITY_IOS && !DELSDK
                        return GetLocale();
#elif UNITY_ANDROID
                        return "CN";
#else
                        return "CN";
#endif
        }


        public static double getScreenHeight(double y)
        {
#if UNITY_EDITOR || DEVELOP
            return 0;
#elif UNITY_IOS && !DELSDK
                        return getScreenHeight(y);
#else
                        return 0;
#endif
        }
        /// <summary>
        /// 判断是否为平板设备
        /// </summary>
        /// <returns></returns>
        public static bool IsPad()
        {
#if UNITY_EDITOR || DEVELOP
            return false;
#elif UNITY_IOS && !DELSDK
                        return IsIPad();
#elif UNITY_ANDROID
                        return false;
#else
                        return false;
#endif
        }
        /// <summary>
        /// 检查版本是否需要更新 且弹出更新弹框
        /// </summary>
        /// <param name="appStoreID"></param> 苹果商店id
        /// <param name="titleText"></param> 标题文字信息
        /// <param name="positiveButtonText"></param>确认按钮的文字信息
        /// <param name="cancelButtonText"></param>取消按钮的文字信息
        /// <param name="customMessageText"></param>自定义 更新信息 如不传 则使用后台更新信息
        public static void CheckUpdate(string appStoreID, string titleText, string positiveButtonText, string cancelButtonText, string customMessageText = "")
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        PopupUpdateNoticeDialog(appStoreID, titleText, positiveButtonText, cancelButtonText, customMessageText);
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
        /// <summary>
        /// 打开应用商店更新Apk，如应用商店无应用，则直接从传入的url直接进行下载安装
        /// </summary>
        /// <param name="targetAppBundleID">目标App的包名</param>
        /// <param name="url">URL. 无法打开商店时的Apk下载地址</param>
        public static void OpenAndroidAppStore(string targetAppBundleID, string downloadUrl)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        SDKFunc.Log("当前平台调用无效");
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("openChinaShop", targetAppBundleID, downloadUrl);
#endif
        }
        /// <summary>
        /// Android Toast弹窗
        /// </summary>
        /// <param name="msg">需要显示的信息</param>
        public static void ShowToast(string msg)
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        showToast(msg);
#elif UNITY_ANDROID
                        if (AJO  != null)
                                AJO.CallStatic("showToast", SDKManager.GetCurrentlyActivity(), msg);
#endif
        }
        public static void RequestiOSIDFAPermission()
        {
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
                        RequestIDFAPermission();
#elif UNITY_ANDROID
                        SDKFunc.Log("当前平台调用无效");
#endif
        }
       


        public static void ShowGDPR(string PrivacyUrl)
        {
            SDKFunc.Log("ShowGDPR");
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
         showGDPR(PrivacyUrl);
#elif UNITY_ANDROID
        if (AJO  != null)
              AJO.CallStatic("showGDPR", SDKManager.GetCurrentlyActivity(), PrivacyUrl);
#endif
        }

        public static int IsDebugOrRelease()
        {
            SDKFunc.Log("IsDebugOrRelease");
#if UNITY_EDITOR || DEVELOP
            return 0;
#elif UNITY_IOS && !DELSDK
         return DebugOrRelease();
#elif UNITY_ANDROID
        bool istrue = true;
        if (AJO  != null)
              istrue = AJO.CallStatic<bool>("readValueFromManifestForDebugModel", "DEBUG_MODEL");
        if(istrue)
            return 1;
        else
            return 0;
#endif 
        }

        /// <summary>
        /// 设置unity log 输出级别
        /// </summary>
        /// <param name="loglevel">(=1 Log, =2 Warning, =3 Error)</param>
        public static void SetLogLevel(string loglevel)
        {
            SDKFunc.Log("SetLogLevel"+ loglevel);
            int iDebugOrRelease = SDKFunc.ObjToInt32(loglevel);
            if (iDebugOrRelease > 0)
            {
                Debug.LogWarning("==UnityLog filterLog level = " + iDebugOrRelease);
            }
            if (iDebugOrRelease == 2)
            {
                Debug.unityLogger.filterLogType = LogType.Warning;
            }
            else if (iDebugOrRelease == 3)
            {
                Debug.unityLogger.filterLogType = LogType.Error;
            }
        }
        //跳转商店评分页
        public static void JumpToComment(bool isCNShow = false)
        {
            SDKFunc.Log("JumpToComment");
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
         jumpToComment();
#elif UNITY_ANDROID
        if (AJO  != null)
        {
            if(isCNShow)
            {
                AJO.CallStatic("jumpToCommentCN");
            }
            else
            {
                //当前是跳转到google商店。应用内评分，可联系SDK集成。
                AJO.CallStatic("jumpToCommentGP");
            }
        }
#endif
        }

        //反射判断Android项目中有没有这个类
        public static bool CheckClass(string className)
        {
            SDKFunc.Log("CheckClass");
#if UNITY_EDITOR || DEVELOP

#elif UNITY_IOS && !DELSDK
        
#elif UNITY_ANDROID
        if (AJO  != null)
        {
            return AJO.CallStatic<bool>("checkClass",className);
        }
#endif
            return false;
        }


    }
}